/*
 * op: message,notification,loading 这里是为了配合element-ui的商户后台涉及
 * type：带有 icon，常用来显示「成功、警告、消息、错误」类的系统消息 success/warning/info/error/info
 * sign：告诉PC接收的，此时是接收提示
 * content：提示内容
 * title：若有标题的时候
 * */
export const showMessage = ({
  op = "message",
  type = "success",
  content = "",
  title = "提示",
}) => {
  return new Promise((resolve, reject) => {
    try {
      console.log("执行");
      const message = {
        sign: "message",
        params: {
          op,
          type,
          content,
          title,
        },
      };
      window.parent.postMessage(message, "*");
      resolve();
    } catch (e) {
      reject(e);
    }
  });
};
